#pragma once

#include <stdint.h>

#ifndef fourcc
#define fourcc(a, b, c, d)  ((uint32_t)(a) | ((uint32_t)(b) << 8) |((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
#endif
#ifndef fourccs
#define fourccs(str)  (*(uint32_t*)(str))
#endif

typedef void (*camera_data_callback)(const void* buf, int buflen, void* udata);

typedef void (*camera_list_callback)(const char* name, void* udata);

typedef struct _camera* camera_t;

#define CAMERA_MAX_RESOLUTION  0x01 //最大分辨率
#define CAMERA_MIN_RESOLUTION  0x02 //最小分辨率
#define CAMERA_PREFER_GRAY     0x10 //偏向取灰度图
#define CAMERA_PREFER_RGB      0x20 //偏向取RGB图

int camera_list(camera_list_callback cb, void* udata);

camera_t camera_open(int index, int flag);

int camera_close(camera_t c);

int camera_set_callback(camera_t c, camera_data_callback cb, void* udata);

uint32_t camera_get_type(camera_t c);

int camera_get_width(camera_t c);

int camera_get_height(camera_t c);


